A machine-to-machine (Machine to Machine, M2M for short) technology is a networked application technology using intelligent interaction between machines as a core. With development of the M2M technology, higher requirements are imposed on various capabilities of an M2M device in M2M communications.
In an existing M2M system, a newly-added M2M device first needs to send a registration request to an M2M service platform. The registration request includes capability information for describing various capabilities of the M2M device. When determining that the M2M device can register with the M2M service platform, the M2M service platform stores, in a corresponding database, a correspondence between an identifier of the M2M device and the capability information of the M2M device. When an M2M device on which an application program (app) is installed sends a query request to the M2M service platform, the M2M service platform sequentially queries, according to a query condition (such as a condition of meeting a preset capability) carried in the query request, correspondences that are recorded in the database and that are between identifiers of M2M devices and capability information of various capabilities of the M2M devices, so as to obtain a device that meets the query condition.
However, in the existing M2M system, the M2M service platform stores, in a corresponding sub-database, the correspondences between identifiers of M2M devices and capability information of the M2M devices. As a result, during a query, massive data queries need to be performed on capability information that is of all capabilities and that is stored in the database. Therefore, a query latency is relatively long, and hardware resources of the M2M service platform are wasted.